<!DOCTYPE html>
<html class="x-admin-sm">

    <head>
        <title>自动添加好友编辑</title>
        <#include "/common/common.ftl">
    </head>
    <body style="background-color:#fff">
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" lay-filter="example">
                    <input type="hidden" name="tokens" value="${tokens!}">
                    <input type="hidden" name="id" value="${(info.id)!}">
                    <input type="hidden" name="tasktype" value="3">
                    <input type="hidden" name="restype" value="0">
                  
                   <div class="layui-form-item">
                        <label class="layui-form-label">
                          <span class="x-red">*</span>执行微信：
                        </label>
                        <div class="layui-input-inline">
                            <select title="执行微信" name="wechatids" class="ui selection search dropdown" required="" lay-verify="required" lay-search>
                                <option value="" <#if info?? && info.wechatids??> <#else> selected</#if> >请选择</option>
                                <#list wechatlist as wechatlist>
                                    <option value="${wechatlist.wechatid!}"  <#if wechatlist.wechatid?? && info?? && info.wechatids?? && wechatlist.wechatid == info.wechatids > selected</#if>  >${wechatlist.wechatnick}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                  
                    <div class="layui-form-item">
                          <label class="layui-form-label">
                              <span class="x-red">*</span>执行时间：
                         </label>
                        <div class="layui-input-inline">
                              <input type="text" name="execute_time" id="execute_time" required="" lay-verify="required"
                                autocomplete="off" class="layui-input" value="${(info.execute_time)!}" placeholder="yyyy-MM-dd HH:mm" maxlength="100" >
                          </div>
                    </div>
                    
                    
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class="x-red">*</span>手机号/微信号(多个用英文逗号,隔开)：
                        </label>
                        <div class="layui-input-inline">
                             <textarea  name="content" required="" lay-verify="required"  class="layui-textarea" maxlength="500">${(info.content)!}</textarea> 
                        </div>
                    </div>
                    
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class="x-red">*</span>验证消息：
                        </label>
                        <div class="layui-input-inline">
                             <textarea  name="comment" required="" lay-verify="required"  class="layui-textarea" maxlength="500">${(info.comment)!}</textarea> 
                        </div>
                    </div>
                     
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <button class="layui-btn" lay-filter="add" lay-submit="">提交</button>
                    </div>
              </form>
            </div>
        </div>
        <script type="text/javascript">
            layui.use(['form', 'layer','laydate'], function () {
                var laydate = layui.laydate;
				laydate.render({
				    elem: '#execute_time',
				    type: 'datetime',
				    format:'yyyy-MM-dd HH:mm'
				});
            
                var form = layui.form;
                var layer = layui.layer;
                var $ = layui.$;

                
                form.on('submit(add)', function (data) {
                    $('.layui-form-item .layui-btn').prop('disabled', true);
                    $('.layui-form-item .layui-btn').text('提交中...');
                    var id = $("input[name='id']").val();
                    var url = (id == null || id === '') ? '/user/taskTime/add' : '/user/taskTime/update';
                    $.ajax({
                        type: 'post',
                        url: url,
                        data: data.field,
                        dataType: 'json',
                        success: function (data) {
                            if (data.code !== 0) {
                                $('.layui-form-item .layui-btn').prop('disabled', false);
                                $('.layui-form-item .layui-btn').text('提交');
                                layer.msg(data.msg);
                                return false;
                            }
                            xadmin.close();
                            layer.closeAll();
                            parent.reload();
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            $('.layui-form-item .layui-btn').prop('disabled', false);
                            $('.layui-form-item .layui-btn').text('提交');
                            layer.msg('系统异常');
                        }
                    });
                    return false;
                });
            });
            
        </script>
        <style type="text/css">
            .layui-form-label {
                width: 200px;
            }
        </style>
    </body>
</html>
